package com.itheima.mapper;

import com.itheima.domain.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StudentMapper {


    //查询所有
    @Select("SELECT * FROM student")
    List<Student> testFindAll();

    @Insert("INSERT INTO student VALUES (#{id},#{name},#{birthday},#{address})")
    void testSave(Student student);
    //新增

    //主键查询
    @Select("SELECT * FROM student WHERE id=#{id}")
    Student testFindById(String id);

    //根据id修改name
    @Update("UPDATE student SET name=#{name},birthday=#{birthday},address=#{address} WHERE id=#{id}")
    void testUpdate(Student student);

    //主键删除
    @Delete("DELETE FROM student WHERE id=#{id}")
    void testDeleteById(String id);
}
